package com.utils;

/**
 * User: oleksandr.baglai
 * Date: 11/10/12
 * Time: 7:50 PM
 */
public class FigureMover {

    private TetrisGlass glass;

    public FigureMover(String glassString, String figureString, int rotate, int x, int y) {
        glass = new TetrisGlass(glassString, 10, 20);
        Figure figure = TetrisFigure.Type.getFigure(figureString, PlotColor.BLUE);
        figure.rotate(rotate);
        if (glass.accept(figure, x, y)) {
            glass.drop(figure, x, y);
        } else {
            throw new RuntimeException(String.format("Bad coordinates (x:%s, y:%s) for figure %s", x, y, figureString));
        }
    }

    public String getGlass() {
        return glass.toString();
    }

}
